package ar.edu.unicen.pladema.vc1.wellcome;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;

import ar.edu.unicen.pladema.main.SWTUtils;
import ar.edu.unicen.pladema.ui.panel.AbstractPanel;

public class WellcomePanel extends AbstractPanel {
	private Label title;
	private Link src;
	
	public WellcomePanel(Composite parent) {
		super(parent);
	}

	@Override
	protected void createWidgets() {
		title = new Label(this, SWT.NONE);
		title.setText("Visualización Computacional I");
		Font f = new Font(this.getDisplay(), "Arial", 24, SWT.BOLD);
		title.setFont(f);
		//src = new Link(this, SWT.NONE);
		//src.setText("El código fuente de esta aplicación se encuentra en <a href=\"http://google.com\">aca</a>");
		src = SWTUtils.createLink(this, "SOURCE", new SelectionListener() {
			
			@Override
			public void widgetSelected(SelectionEvent arg0) {
				org.eclipse.swt.program.Program.launch("http://code.google.com/p/sp-vc1/");
				System.out.println("ws");
			}
			@Override
			public void widgetDefaultSelected(SelectionEvent arg0) {
				org.eclipse.swt.program.Program.launch("http://code.google.com/p/sp-vc1/");
				System.out.println("wds");
			}
		});
	}
	
	@Override
	protected void layoutWidgets() {
		setLayout(new FormLayout());
	
		title.setLayoutData(SWTUtils.createTopFormData());
		src.setLayoutData(SWTUtils.createBelowFormData(title,10));
	}

}
